import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'

import Login from "../views/Login.vue";
import SystemAdmin from "@/views/SystemAdmin.vue";
import Test1 from "@/views/Test1.vue";
import DormitoryAdminManager from "@/views/DormitoryAdminManager.vue";
import DormitoryAdminAdd from "@/views/DormitoryAdminAdd.vue";
import DormitoryAdminUpdate from "@/views/DormitoryAdminUpdate.vue";
import StudentAdd from "@/views/StudentAdd.vue";
import StudentManager from "@/views/StudentManager.vue";
import StudentUpdate from "@/views/StudentUpdate.vue";
import BuildingAdd from "@/views/BuildingAdd.vue";
import BuildingManager from "@/views/BuildingManager.vue";
import BuildingUpdate from "@/views/BuildingUpdate.vue";
import DormitoryAdd from "@/views/DormitoryAdd.vue";
import DormitoryManager from "@/views/DormitoryManager.vue";
import DormitoryUpdate from "@/views/DormitoryUpdate.vue";
import MoveoutRegister from "@/views/MoveoutRegister.vue";
import MoveRecord from "@/views/MoveRecord.vue";
import AbsentRecord from "@/views/AbsentRecord.vue";
import DormitoryAdmin from "@/views/DormitoryAdmin.vue";
import AbsentRegister from "@/views/AbsentRegister.vue";
Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: '/test',
    name: 'test',
    component: Test1
  },
  {
    path: '/dormitoryAdmin',
    name: '宿舍管理员',
    component: DormitoryAdmin,
    redirect: '/absentRecord2',
    children: [
      {
        path: '/absentRecord2',
        name: '缺勤记录',
        component: AbsentRecord
      },
      {
        path: '/absentRegister',
        name: '缺寝登记',
        component: AbsentRegister,
      }
      ]
  },
    {
    path: '/systemAdmin',
    name: '系统管理员',
    component: SystemAdmin,
      redirect: '/dormitoryAdminAdd',
      children: [
        {
          path: '/dormitoryAdminManager',
          name: '宿管管理',
          component: DormitoryAdminManager
        },
        {
          path: '/dormitoryAdminAdd',
          name: '添加宿管',
          component: DormitoryAdminAdd
        },
        {
          path: '/dormitoryAdminUpdate',
          name: '编辑宿管',
          component: DormitoryAdminUpdate
        },
          {
          path: '/studentAdd',
          name: '添加学生',
          component: StudentAdd
        },
        {
          path: '/studentManager',
          name: '学生管理',
          component: StudentManager
        },
        {
          path: '/studentUpdate',
          name: '编辑学生',
          component: StudentUpdate
        },
        {
          path: '/buildingAdd',
          name: '添加楼栋',
          component: BuildingAdd
        },
        {
          path: '/buildingManager',
          name: '楼栋管理',
          component: BuildingManager
        },
          {
          path: '/buildingUpdate',
          name: '编辑楼栋',
          component: BuildingUpdate
        },
        {
          path: '/dormitoryAdd',
          name: '添加宿舍',
          component: DormitoryAdd
        },
        {
          path: '/dormitoryManager',
          name: '宿舍管理',
          component: DormitoryManager
        },
        {
          path: '/dormitoryUpdate',
          name: '编辑宿舍',
          component: DormitoryUpdate
        },
          {
          path: '/moveoutRegister',
          name: '搬出登记',
          component: MoveoutRegister
        },
        {
          path:'/moveoutRecord',
          name:'迁出记录',
          component:MoveRecord
        },
          {
          path:'/absentRecord',
          name:'缺勤记录',
          component:AbsentRecord
        }
      ]
  },
  {
    path: '/login',
    name: '登陆',
    component: Login
  },

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
